1. Field of the Invention
The present invention relates to techniques for analyzing program correctness. More specifically, the present invention relates to a method and an apparatus for statically analyzing program correctness for a program written in a dynamic programming language.
2. Related Art
A compiler is a computer program that translates program text written in a high-level programming language into executable instructions. Program developers generally specify the functionality of a given program using such a high-level programming language, and then use the compiler to convert the high-level structures of that programming language into machine-specific instructions.
In a statically-typed programming language, the compiler can verify and enforce the data-types for the language (e.g., perform “type-checking”) at compile time, which means that the system does not need to resolve any data-types at run-time. For instance, the compiler for a statically-typed language can determine the correct method implementation for a called program method at compile time, and can then include this method implementation in the executable program binary. Alternatively, in a dynamically-typed programming language, data-types may not be known until run-time. Because of this ambiguity, an incomplete program written in such a language may still compile and link, but may not run correctly due to method calls that cannot be resolved at run-time. For instance, program methods hidden in an obscure conditional execution path may not be detected by program testing, and may result in program failure after the program has been released.
Hence, what is needed is a method that facilitates writing programs in dynamic programming languages without the above-described limitations.